<template>
  <div class="content-component">
    <component :is="templateName" v-if="templateName" :show-header="true" :temp="temp" :params="params" />
  </div>
</template>

<script>
export default {
  name: 'MobileEntityContent',
  data() {
    return {
      setting: {},
      params: [],
      temp: null,
      templateName: null,
      showMenu: true
    }
  },
  watch: {
    setting: {
      handler(newName, oldName) {
        this.params = newName.params
        this.temp = newName.temp
        const path = '/' + this.temp.ssdl + '/' + this.temp.mbmc
        const res = () => import(`@/template/entityTemp${path}`)
        this.templateName = res
      },
      immediate: false, // 父组件第一次传值时，执行handler，false则第一次不执行
      deep: false // formType为对象时，设置为true，此属性监听对象发生变化
    }
  },
  methods: {
    init(data) {
      this.setting = data
    }
  }
}
</script>

<style scoped>

</style>
